<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<title></title>
		<script src="js/vue.js" type="text/javascript" charset="utf-8"></script>
	</head>
	<body>
		<div id="app">
			
			<h1>{{msg}}</h1>
			<h1>{{reverseMsg}}</h1>
			<ul>
				<li v-for="item in arr">{{item}}</li>
			</ul>
		</div>
		
		
		<script type="text/javascript">
			var app = new Vue({
				el:"#app",
				data:{
					msg:"hello Vue",
					arr:['小明','小红',"小黑"]
				},
				computed:{
					reverseMsg:{
						get:function(){
							return this.msg.split("").reverse().join("")
						},
						set:function(value){
							//console.log(value)
							this.msg = value.split("").reverse().join("")
						}
					}
				},
				watch:{
					msg:function(val){
						console.log("监听事件-------msg")
						console.log(val)
					},
					arr:function(val){
						console.log("监听事件-------arr")
						this.msg = "监听事件-------arr"
						console.log(val)
					}
				}
			})
		</script>
	</body>
</html>
